//
//  ToViewBankViewController.m
//  lmq
//
//  Created by 马田成 on 2017/3/22.
//  Copyright © 2017年 yuanxin. All rights reserved.
//

#import "ToViewBankViewController.h"
#import "ToViewMyBankTableViewCell.h"
#import "Masonry.h"

@interface ToViewBankViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation ToViewBankViewController
//查看银行卡

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creationView];
    [self regeditCell];
    
    // Do any additional setup after loading the view from its nib.
}

- (void)creationView{
    
    self.navigationItem.title = @"银行卡";

//    self.tableView.tableFooterView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0,DEF_SCREEN_WIDTH, 120)];
//
//    self.tableView.tableFooterView.userInteractionEnabled = YES;
//
//    self.view.backgroundColor = [UIColor colorWithRed:228 / 255.0f green:228 / 255.0f blue:228 / 255.0f alpha:1];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
   
    
    

    
}
- (void)regeditCell{
    
    
    
    [self.tableView registerNib:[UINib nibWithNibName:@"ToViewMyBankTableViewCell" bundle:nil] forCellReuseIdentifier:@"ToViewMyBankTableViewCell"];
    
}

#pragma mark - ---------- Section的数量 ----------
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

#pragma mark - ---------- 每个Section的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}

#pragma mark - ---------- Cell的数量 ----------
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
    
    
}

#pragma mark - ---------- 每个Cell的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 110;
    
}
#pragma mark - ---------- 每个Cell的内容 ----------
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    ToViewMyBankTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"ToViewMyBankTableViewCell" forIndexPath:indexPath];
    
    
    
    
    return cell;
    
    
}

//自定义section的尾部
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView *xView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, (80))];
    //add your code behind
//    UIButton *tiButton=[[UIButton alloc]initWithFrame:CGRectMake((DEF_SCREEN_WIDTH-(330))/2, (40), (330), (40))];
    UIButton *tiButton = [[UIButton alloc] init];
    [xView addSubview:tiButton];
    [tiButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(xView).with.offset(40);
        make.left.equalTo(xView).with.offset(20);
        make.right.equalTo(xView).with.offset(-20);
        make.height.offset(40);
        
    }];
    tiButton.backgroundColor=[ZJCModel colorWithString:@"222222"];
    [tiButton setTitle:@"添加银行卡" forState:UIControlStateNormal];
    [tiButton addTarget:self action:@selector(tiButtonClick) forControlEvents:UIControlEventTouchUpInside];
    
    
    return xView;
}
//自定义section尾部的高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return (80);
}

-(void)tiButtonClick{
    NSLog(@"添加银行卡");
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
